package com.prs.crm.dao.cdxh.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.HibernateCallback;

import com.prs.crm.dao.cdxh.EarningSalDao;
import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.domain.cdxh.EarningSal;
import com.prs.crm.domain.cdxh.HrPerson;

/**
 * @author LanXiaoGang
 * @E-mail:lan9liang@163.com
 * @qq:7857553326
 * @version 创建时间：2010-12-16 下午01:10:01
 * 简单说明
 */

public class EarningSalDaoImpl extends BaseDaoImpl<EarningSal> implements
		EarningSalDao {

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	public List<EarningSal> getEarningSal(final String hrname,final String date) {
		return (List<EarningSal>)this.getHibernateTemplate().execute(
			      new HibernateCallback() {   
						public Object doInHibernate(Session session) throws HibernateException {
				        	Criteria criteria = session.createCriteria(EarningSal.class);
				        	criteria.add(Restrictions.eq("hrName", hrname));
				        	criteria.add(Restrictions.eq("currentDate", date));			        	
				        	List<EarningSal> result = criteria.list();
				        	System.out.println("result="+result);
				        	
				        	
				        			return result;
				        		
				         
				 } });
	}

}
